<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Customer extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		//$this->load->database();
		$this->load->model('customer_m');
	}

	public function index(){
		$this->view();
	}

	public function show($customer_code = 0)
	{
		//Always ensure an integer
		$customer_code = (int)$customer_code;
		//Load the user factory
		$this->load->library("User_f");
		//Create a data array so we can pass information to the view
		$data = array(
				"users" => $this->user_f->getUser($customer_code)
		);
		//Load the view and pass the data to it
// 		$this->load->view("user_v", $data);
		$this->load->view('customer/regist', $data);
	}

	public function view(){
		$this->load->view('common/header');
		//$hello = $this->customer_m->get_helloworld();

		//$this->load->view('customer/regist', array('hello'=>$hello));
 		$this->load->view('customer/regist');
		$this->load->view('common/footer');
	}

	public function regist(){
		$this->load->view('common/header');
		//$hello = $this->customer_m->get_helloworld();
		$post = $this->input->post(NULL, TRUE);
		$rtn = $this->customer_m->insert_customer($post);
		//$this->load->view('customer/regist', array('hello'=>$hello));
		$this->load->view('customer/regist', $post);
		$this->load->view('common/footer');
	}
}

